<?php

use App\Http\Controllers\Common\MerchantController;
use App\Http\Controllers\Fee\FeishuApply\FeeAnnualOrderController;
use App\Http\Middleware\OpenShop\AppletAuth;
use Illuminate\Support\Facades\Route;
use App\Http\Middleware\OpenShop\MerchantAppAuth;
use App\Http\Controllers\Fee\Merchant\PayController;

/**
 *
 * 年费订单功能路由
 */


Route::get('test', function () {
   return '年费订单路由文件';
});

Route::middleware([AppletAuth::class])->group(function () {

    Route::group(['prefix' => 'feishuApply'], function () {
        Route::get('head/title', [FeeAnnualOrderController::class, 'headTitle']);
        //统计头
        Route::get('annualOrder/count', [FeeAnnualOrderController::class, 'countStatusNumber']);
        //年费列表
        Route::get('annualOrder/list', [FeeAnnualOrderController::class, 'list']);
        //年费订单详情
        Route::get('annualOrder/detail/{id}', [FeeAnnualOrderController::class, 'detail']);

        //半年付订单
        //Route::post('feeOrder/split/{id}', [FeeAnnualOrderController::class, 'splitFeeOrder']);

    });

});

Route::prefix('merchant')->middleware(MerchantAppAuth::class)->group(function () {

    Route::prefix('pay')->group(function () {
        Route::get('detail', [PayController::class, 'detail']);

        // 金额为0的年费支付
        Route::post('/', [PayController::class, 'pay']);
    });

    //首页通知条
    Route::get('notice/list', [MerchantController::class, 'noticeList']);
});



// web端后台路由
Route::prefix('web')->middleware([
    \App\Http\Middleware\OpenShop\FeishuWebAuth::class,
    \App\Http\Middleware\OpenShop\UserPermissionAuth::class . ':' . \App\Http\Middleware\OpenShop\UserPermissionAuth::MODULE_OPEN_SHOP
])->group(function () {

    Route::group(['prefix' => 'annualOrder'], function () {
        Route::get('list', [FeeAnnualOrderController::class, 'webLists']);
        Route::post('delay', [FeeAnnualOrderController::class, 'delay']);
        Route::post('reduce', [FeeAnnualOrderController::class, 'reduce']);

        // 修改年费收取日期
        Route::post('editFeeTime', [FeeAnnualOrderController::class, 'editFeeTime']);
    });
});

Route::group(['prefix' => 'common'], function () {

    // 门店年费订单到期时间
    Route::get('getExpired', [PayController::class, 'getExpired']);
});

